<!--
 * @Description: 窗帘
 * 
 * @Author: XiongYaoYuan<xiongyaoyuan>
 * @Date: 2023-07-31 10:15:16
 * @FilePath: /yuxiuproweb/src/views/mes/pro/workorder/split/cl.vue
-->
<template>
  <el-collapse-item title="窗帘" name="1" disabled>
    <el-table :data="list" :span-method="objectSpanMethod" style="width: 100%">
      <el-table-column prop="i" label="序号" min-width="50" align="center">
      </el-table-column>
      <el-table-column prop="roomName" label="房间" align="center">
      </el-table-column>
      <template v-if="!!type">
        <el-table-column prop="lastProcessName" label="最近工序" align="center">
        </el-table-column>
        <el-table-column prop="lastProcessTime" label="工序时间" align="center">
          <template slot-scope="{ row }">
            {{ parseTime(row.lastProcessTime, "{y}-{m}-{d}") }}
          </template>
        </el-table-column>
      </template>
      <el-table-column
        prop="curtainName"
        label="窗帘名称"
        align="center"
      ></el-table-column>
      <el-table-column prop="width" label="宽" min-width="60" align="center">
      </el-table-column>
      <el-table-column prop="height" label="高" min-width="60" align="center">
      </el-table-column>
      <el-table-column
        prop="processInfo"
        label="加工方式+分片|倍率"
        min-width="150"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="complexMachining"
        label="复杂加工"
        min-width="100"
        align="center"
      >
      </el-table-column>
      <el-table-column label="用料明细" align="center">
        <el-table-column
          prop="part"
          label="位置"
          min-width="100"
          align="center"
        >
          <template slot-scope="{ row }">
            <template v-if="row.part2 === '0'">
              {{
                getTypeName(
                  dict.type.md_complex_machining_model_part_1,
                  row.part
                ) || row.part
              }}
            </template>
            <template v-else-if="row.part2 === '1'">
              {{
                getTypeName(
                  dict.type.md_complex_machining_model_part_2,
                  row.part
                ) || row.part
              }}
            </template>
            <template v-else-if="row.part2 === '-1'">主布</template>
            <template v-else>{{ row.part }}</template>
          </template>
        </el-table-column>
        <el-table-column
          prop="source"
          label="来源"
          min-width="100"
          align="center"
        >
          <template slot-scope="{ row }">
            {{
              row.source === "0"
                ? "自有"
                : row.source === "1"
                ? "余料"
                : row.source === "2"
                ? "来料"
                : ""
            }}
          </template>
        </el-table-column>
        <el-table-column
          prop="fabricName"
          label="品名"
          min-width="120"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="fabricWidth"
          label="门幅"
          min-width="100"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="direction"
          label="方向"
          min-width="100"
          align="center"
        >
          <template slot-scope="{ row }">
            {{
              row.direction === "0"
                ? "定宽"
                : row.direction === "1"
                ? "定高"
                : ""
            }}
          </template>
        </el-table-column>
      </el-table-column>
      <el-table-column label="销售清单" align="center">
        <el-table-column
          prop="priceName"
          label="名称"
          min-width="140"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="price"
          label="单价"
          min-width="100"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="subTotal"
          label="小记"
          min-width="100"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="totalPrice"
          label="合计"
          min-width="120"
          align="center"
        >
        </el-table-column>
      </el-table-column>
    </el-table>
  </el-collapse-item>
</template>

<script>
export default {
  dicts: [
    "order_curtain_section",
    "md_complex_machining_model_part_1",
    "md_complex_machining_model_part_2",
  ],
  props: {
    show: Boolean,
    list: {
      type: Array,
      default: () => [],
    },
    type: {
      type: String,
      default: "",
    },
  },
  data() {
    return {};
  },
  created() {
    console.log(this.list);
  },
  methods: {
    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
      if (
        (this.type
          ? [0, 1, 2, 3, 4, 5, 6, 7, 8, 17]
          : [0, 1, 2, 3, 4, 5, 6, 15]
        ).includes(columnIndex)
      ) {
        if (row.begin === rowIndex) {
          return {
            rowspan: row.fabricVOList.length,
            colspan: 1,
          };
        } else {
          return {
            rowspan: 0,
            colspan: 0,
          };
        }
      }
    },
  },
};
</script>

<style scoped lang="scss">
::v-deep {
  .el-table--border,
  .el-table--group {
    border: 1px solid #000 !important;
  }
  /**
改变表格内竖线颜色
 */
  .el-table--border td,
  .el-table--border th,
  .el-table__body-wrapper
    .el-table--border.is-scrolling-left
    ~ .el-table__fixed {
    border-right: 1px solid #000 !important;
  }
  /**
改变表格内行线颜色
 */
  .el-table td,
  .el-table th.is-leaf,
  .el-table__cell {
    border-bottom: 1px solid #000 !important;
  }
}
</style>
